package com.conversationboard.api.xml;

import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;

public class ApiXPath {

	public static XPathExpression requestTypesExpression;
	public static XPathExpression loginExpression;
	public static XPathExpression logoutExpression;
	public static XPathExpression passwordExpression;
	public static XPathExpression encryptedExpression;
	public static XPathExpression returnEncryptedPasswordExpression;
	public static XPathExpression boardIdExpression;
	public static XPathExpression threadIdExpression;

	private static XPath xPath;

	static {

		XPathFactory pathFactory = XPathFactory.newInstance();
		xPath = pathFactory.newXPath();

		try {

			/* Login/Logout */

			requestTypesExpression = xPath.compile("/Requests/*");
			loginExpression = xPath.compile("/Requests/Login/LoginId/text()");
			logoutExpression = xPath.compile("/Requests/Logout/text()");
			passwordExpression = xPath.compile("/Requests/Login/Password/text()");
			encryptedExpression = xPath.compile("/Requests/Login/Encrypted/text()");
			returnEncryptedPasswordExpression = xPath.compile("/Requests/Login/ReturnEncryptedPassword/text()");

		} catch (XPathExpressionException e) {
		}

	}


	public static XPath getXPath() {
		return xPath;
	}

}
